class Solution:
    def partition(self, s):
        def is_palindrome(sub):
            return sub == sub[::-1]

        def backtrack(start, path):
            if start == len(s):
                result.append(path[:])  # 用 path[:] 代替 path.copy() 兼容性更好
                return

            for end in range(start + 1, len(s) + 1):
                current_sub = s[start:end]
                if is_palindrome(current_sub):
                    path.append(current_sub)
                    backtrack(end, path)
                    path.pop()

        result = []
        backtrack(0, [])
        return result
